// 存储数据的工具类, 存储数据到sessionStorage中, 存储数据到localStorage中
export default {
  set: (key: string, data: any) => {
    sessionStorage.setItem(key, data)
  },
  get: (key: string, defaultValue: any = null) => {
    return sessionStorage.getItem(key) || defaultValue
  },
  remove: (key: string) => {
    sessionStorage.removeItem(key)
  },
  clear: () => {
    sessionStorage.clear()
  },
  _setLocal: (key: string, data: any) => {
    localStorage.setItem(key, data)
  },
  _getLocal: (key: string, defaultValue: any = null) => {
    return localStorage.getItem(key) || defaultValue
  },
  _removeLocal: (key: string) => {
    localStorage.removeItem(key)
  },
  _clearLocal: () => {
    localStorage.clear()
  },
}